package cn.wsn2018.tools.util.rsa;

import java.util.Map;

public class Test {
    public static void main(String[] args) throws Exception {
//        Map<String, Object> genKeyPair = RSAUtils.genKeyPair();
//        String publicKey = RSAUtils.getPublicKey(genKeyPair);
//        String privateKey = RSAUtils.getPrivateKey(genKeyPair);
//        System.out.println("publicKey:"+publicKey);
//        System.out.println("privateKey:"+privateKey);

        //String str="song88";

//        byte[] bytes1 = RSAUtils.encryptByPublicKey(str.getBytes(), publicKey);
//        String encodeStr = new String(bytes1);
//        System.out.println("加密后："+encodeStr);
//
//        byte[] bytes = RSAUtils.decryptByPrivateKey(Base64Utils.decode(encodeStr), privateKey);
//        String s = new String(bytes);
//        System.out.println("解密："+s);
        String pk="MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAJBoNXK6kF+pQi2a/adFGzbFq+yRwxyE6a4sDJrTRgfQNHs2l5NMyFmqx/wOfuE5NMVB2u8J0vL/puLHp/V2Rosrzq0aQJ1Hbl8Vxx6ny6+tbQBRYAEZT9ZZBgZnpBFBboSIs9UXBSQ0c4zw+QVVlYIxDpQNMIRzgTiT6HqcmR/9AgMBAAECgYAqg2No2V/zqcLf5kdS3Vd7sopA5VDJrp+VNUaothZh6nvo4lORfANn0o15uVLFP7A3eoHX6c5+16DsFtdtvlpZ4NAtO8pmn8pI63BhAHqMhyPtu9Z4sbWTpjW9ykDX5Iqbxkd9MZq5ztVSqLuDFN8DMiHHuLPrGsGf+/aM7B08yQJBANRlK7nKApKSgoxqC+sDc4QAxSc02ptyu/pcFSTpH1etCnVLp6K2mBC0R13p6l9mqtWDXQVH8hkDnj7bG9OpdpcCQQCuDcsz1VXC8BKzpVp7Pgt4k2oO6Z/DHvnJFZNSFi0muwY0YBdBTeRM8ZeZSvmFMDGYCN5P6E8S6U5BwL8166SLAkBZY5L5iFl40ox7CA6oBDXTsndHPulaTvlqLuL/O9XjEoK6RvLweiSZsyXuEop/SDhR0A2QMW1kta8eCR03AbVVAkEAjZQgz2fgG/JmdASz5f3hHNJkef7lerUun7fSHvp0/cUx1da38+HlLAV0uDe5YfKC1NWZ6EviTlLC2k9r+fNU4wJBAM5y00JBn9D34XwvQ6QweUBUYPaU/+28Pm1k/mGfNUFhY1oGXSu/ngljK0/altvYxKYEywZfQJS/JkPkgmmhFZ4=";
        String encodeStr="IWsz8HEWi1LwQLdQ967vbt3VGFYLQhW/keKK0y1PcYfEcRXvbmNdlP7FAHA9SH2NwJfRoR3J/tw2ZHQbEIK1ELlrnNBvDRYcDYH1yv1YCM6BJpkGRjlhfyRdtMlIO9Te/VylQzPcRX7mvv1mftySm62iy4ma3chWDBp19/O5C1Y=\n";
        byte[] bytes = RSAUtils.decryptByPrivateKey(Base64Utils.decode(encodeStr), pk);
        System.out.println(new String(bytes));
    }
}
